mport datetime
import sys


def main():
    if len(sys.argv) == 3:
         month = int(sys.argv[1])
         year = int(sys.argv[2])
    else:
        curr_date = datetime.datetime.now()
        year = curr_date.year
        month = curr_date.month
        print(year, month)
r=year%400==0 or (year%4==0 and year%100!=0)
listr=[31,29,31,30,31,30,31,31,30,31,30,31]
listp=[31,28,31,30,31,30,31,31,30,31,30,31]
dayy=365*(year-1900)+(year-1900-1)//4-(year-1900-1)//100+(year-1600-1)//400
#print(dayy)
daym=0
if r:
    for i in range(0,month-1):
            daym+=listr[i]
            else:
                for i in range(0,month-1):
                        daym+=listp[i]
days=daym+dayy
week=days%7
print(" 星期一",end="")
print(" 星期二",end="")
print(" 星期三",end="")
print(" 星期四",end="")
print(" 星期五",end="")
print(" 星期六",end="")
print(" 星期日")
f week==0:
    print("       "*0,end="")
    elif week==1:
    print("       "*1,end="")
    elif week==2:
    print("       "*2,end="")
    elif week==3:
    print("       "*3,end="")
    elif week==4:
    print("       "*4,end="")
    elif week==5:
    print("       "*5,end="")
    elif week==6:
    print("       "*6,end="")
if r:
    i=1
        while i<=listr[month-1]:
                print("   %2d  "%i,end="")
                        if (i+week)%7==0:
                                    print()
                                            i+=1
else:
    i = 1
        while i <= listp[month - 1]:
                print("   %2d  " %i,end="")
                        if (i + week) % 7 == 0:
                                    print()
                                            i += 1
if __name__ == '__main__':
    main()



























































